<?php

class Divisi extends Default_My_Model {
    private $QRY = "SELECT * from mt_divisi";
    
    function __construct()
    {
        parent::__construct();
    }
    
    

    public function getDataDivisi($whr, $ct_pagelimit, $offset) {
        if ($whr != "") {
            $SQL = $this->QRY ." where id_divisi !=4 and " . $whr ."  ORDER BY divisi ASC LIMIT ". $ct_pagelimit ." OFFSET ". $offset;
        } else {
            $SQL = $this->QRY ." where id_divisi !=4 ORDER BY divisi ASC LIMIT ". $ct_pagelimit ." OFFSET ". $offset;
        }
        $resultSet = $this->db->query($SQL);
        return $resultSet;
    }
    
    public function getDataAllDivisi($whr) {
        $resultSet = array();
        if ($whr != "") {
            $resultSet['data'] = $this->db->query($this->QRY ." where id_divisi !=4 and " . $whr . " order by divisi ASC");
        } else {
            $resultSet['data'] = $this->db->query($this->QRY . " where id_divisi !=4 order by divisi ASC");
        }
        $resultSet['query'] = $this->db->last_query();
        return $resultSet;
    }
    
    public function removeDataDivisi($id_user) {
        $this->db->where('id_divisi', $id_user);
        $this->db->delete('mt_divisi', $where);
    }
    
    public function addDataDivisi($arrVals) {
        $this->db->insert('mt_divisi', $arrVals);
    }
    
     public function getDataSingleDivisi($whr) {
        $SQl = $this->QRY." WHERE id_divisi = '" . $whr . "'";
        $resultSet = $this->db->query($SQl);
        return $resultSet;
    }

    public function updateDataDivisi($id_user, $arrVals) {
        $this->db->where('id_divisi', $id_user);
        $this->db->update("mt_divisi", $arrVals);
    }

}

?>
